home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Caml Light 0.61 / Source / src / lib / parsing.mli < prev    next >
Encoding:
Text File  |  1993-09-24  |  1.9 KB  |  55 lines  |  [TEXT/MPS ]

  1. (* The run-time library for parsers generated by mlyacc *)
  2.  
  3. #open "obj";;
  4. #open "lexing";;
  5.  
  6. (* The following functions can be called by user code. *)
  7.  
  8. value symbol_start : unit -> int
  9.   and symbol_end : unit -> int
  10.         (* [symbol_start] and [symbol_end] are to be called in the action part
  11.            of a grammar rule only. They return the position of the string that
  12.            matches the left-hand side of the rule: [symbol_start()] returns
  13.            the position of the first character; [symbol_end()] returns the
  14.            position of the last character, plus one. The first character
  15.            in a file is at position 0. *)
  16.   and rhs_start: int -> int
  17.   and rhs_end: int -> int
  18.         (* Same as [symbol_start] and [symbol_end] above, but return then
  19.            position of the string matching the [n]th item on the
  20.            right-hand side of the rule, where [n] is the integer parameter
  21.            to [lhs_start] and [lhs_end]. [n] is 1 for the leftmost item. *)
  22.   and clear_parser : unit -> unit
  23.         (* Empty the parser stack. Call it just after a parsing function
  24.            has returned, to remove all pointers from the parser stack
  25.            to structures that were built by semantic actions during parsing.
  26.            This is optional, but lowers the memory requirements of the
  27.            programs. *)
  28. ;;
  29.  
  30. (*--*)
  31.  
  32. (* The following definitions are used by the generated parsers only.
  33.    They are not intended to be used by user programs. *)
  34.  
  35. type parse_tables =
  36.   { actions : (unit -> obj) vect;
  37.     transl : int vect;
  38.     lhs : string;
  39.     len : string;
  40.     defred : string;
  41.     dgoto : string;
  42.     sindex : string;
  43.     rindex : string;
  44.     gindex : string;
  45.     tablesize : int;
  46.     table : string;
  47.     check : string }
  48. ;;
  49.  
  50. exception yyexit of obj
  51.       and Parse_error of (obj -> bool);;
  52.  
  53. value yyparse : parse_tables -> int -> (lexbuf -> 'a) -> lexbuf -> 'b
  54.   and peek_val : int -> 'a;;
  55.